package com.cakemallproject.Util;

import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;

public class ControllerUtil {
    public static boolean validToken(HttpServletRequest request) {
        for (Cookie cookie : request.getCookies()) {
            if (cookie.getName().equals("token")) {
                try {
                    JwtUtil.parseToken(cookie.getValue());
                } catch (RuntimeException e) {
                    return false;
                }
            }
        }
        return true;
    }
}
